﻿#ifndef SHAPELIBRARYPANEL_H
#define SHAPELIBRARYPANEL_H

#include <QWidget>
#include <QGridLayout>
#include <QLineEdit>
#include <QScrollArea>
#include <QVector>

class ShapeLibraryPanel : public QWidget
{
    Q_OBJECT

public:
    explicit ShapeLibraryPanel(QWidget* parent = nullptr);
    void registerShape(); 

protected:
    void resizeEvent(QResizeEvent* event) override;

private slots:
    void onSearchTextChanged(const QString& text);

private:
    void setupUI();
    void updateGridLayout();
    QWidget* createShapeWidget(const QString& name);

    QScrollArea* m_scrollArea;
    QWidget* m_container;
    QGridLayout* m_gridLayout;
    QLineEdit* m_searchBox;
    QVector<QString> m_shapeNames;
    QVector<QWidget*> m_shapeWidgets;
    int m_columns = 4;
    const QSize m_widgetSize = QSize(80, 80);
};

#endif // SHAPELIBRARYPANEL_H